
<html>
    <head>
        <title>test api</title>
        <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <body>
        <?php
        header('content-type:text/html;charset=utf-8');
        require 't2p_api.php';
        $ob = new stdClass();
        $ob->AppCode = "310001";
        $ob->AppPassword = "TEST1";	
        $ob->Check = "check";  // ตัวแปรคงที่
		
/////////////////////Check Channel////////////////////////////////////////				
        $rs = t2p_encrypt(json_encode($ob));
        $call = t2p_checkchannel($rs);				

        if ((md5($call['0'])) == $call['1']) { // Chk ว่าข้อมูลถูกเปลี่ยนระหว่างทางหรือไหม
            $data = json_decode($call['0']);
            echo "<pre>";
            print_r($data);
            echo "</pre>;";			
					
        }	

/////////////////////Generate Data////////////////////////////////////////
$result =  array("action" => "beginPayment", "Mobile" => "0899979229", "channelType" => "3",
			    "channelValue" => "tesco", "amount" => "100",
			    "invoice" => "test2bsimplebbl1234567899sa", "frontUrl" => "http://findhome108.esy.es/test.php", "appCode" => "310001", "appPassword" => "TEST1",
			    "detail" => "test 2bsimple");
				
$result_json = t2p_encrypt(json_encode($result)); 


?>
<!--Post value $result_json  to  t2p -->
<form action="http://test-api.ibaht.com/2bsimple/index.php" method="post">


<input type="hidden" id="beginPayment" name="beginPayment" value="<?php echo $result_json;?>"/>
<button type="submit" id="submit"  name="submit" value="send Data"/>Send Data</button>
</form>        
    </body>
</html>